#!/bin/bash
# Gitee 批量构建所有设备

echo "🏗️  Gitee 批量构建所有设备"

# 设置环境
source scripts/gitee/detect-environment.sh
bash scripts/gitee/setup-mirrors.sh

# 设备列表
DEVICES=("mondrian" "vermeer" "sheng")

# 批量构建
for device in "${DEVICES[@]}"; do
    echo ""
    echo "🔨 构建设备: $device"
    echo "=================================="
    
    if bash scripts/gitee/build-kernel.sh $device; then
        echo "✅ $device 构建成功"
    else
        echo "❌ $device 构建失败"
        # 在 CI 环境中，一个设备失败不影响其他设备
        if [ "$IS_GITEE_CI" = "true" ]; then
            echo "⚠️  CI 环境中继续构建其他设备..."
            continue
        else
            exit 1
        fi
    fi
done

echo ""
echo "🎉 所有设备构建完成!"
echo "📁 输出目录: out/"
echo "📦 产物目录: build_artifacts/"
